﻿CREATE VIEW [acms].[PostUploadSummary_View]
AS 
	SELECT a.*,
		(Select Count(Id) From acms.UserPostUpload_View where PostId = a.Id) as Total,
		(Select Count(Id) From acms.UserPostUpload_View where PostId = a.Id and Reviewed = 1) as Reviewed,
		(Select Count(Id) From acms.UserPostUpload_View where PostId = a.Id and Reported = 1) as Reported,
		(Select Count(Id) From acms.UserPostUpload_View where PostId = a.Id and Suspended = 1) as Suspended
	FROM acms.Post_View a
	Where a.Id in (Select PostId from acms.UserPostUpload_View)
;